package com.hanhanxiaochong.zhongxiangchuanmei.view.shop.adapter;

import android.content.Context;
import android.widget.ImageView;
import android.widget.TextView;

import com.hanhanxiaochong.zhongxiangchuanmei.R;
import com.hanhanxiaochong.zhongxiangchuanmei.bean.ShopDetailProjectBean;
import com.hanhanxiaochong.zhongxiangchuanmei.config.CommonAdapter;
import com.hanhanxiaochong.zhongxiangchuanmei.config.ViewHolder;
import com.hanhanxiaochong.zhongxiangchuanmei.util.glide.GlideImgManager;
import com.wzgiceman.rxretrofitlibrary.retrofit_rx.http.RetrofitSource;

import java.util.List;

/**
 * Author : 贾桐
 * E-mail : 653773284@qq.com
 * Time   : 2018/5/9.
 * Desc   :
 */

public class ShopProjectSecondAdapter extends CommonAdapter<ShopDetailProjectBean.ProjectBean> {

    public ShopProjectSecondAdapter(Context context, int layoutId, List<ShopDetailProjectBean.ProjectBean> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, ShopDetailProjectBean.ProjectBean bean, final int position) {
        ImageView pic = holder.getView(R.id.iv_second_type);
//        ViewGroup.LayoutParams layoutParams = pic.getLayoutParams();
//        layoutParams.height = layoutParams.width;
//        pic.requestLayout();
        TextView typeName = holder.getView(R.id.tv_second_type);
        GlideImgManager.glideLoader(mContext, RetrofitSource.image_url + bean.getPic(), R.mipmap.img_error, R.mipmap.img_error, pic);
        typeName.setText(bean.getName());
        holder.setOnClickListener(R.id.item_shopnext_second, v -> mOnItemClickListener.onItemClick(ShopProjectSecondAdapter.this, position));
    }

}
